import Vue from 'vue'
import VueRouter from 'vue-router'
import index from '../components/index'
import Home from '@/components/HOME/home.vue'
import VIP from '@/components/HOME/vip.vue'
import Car from '@/components/HOME/car.vue'
import My from '@/components/HOME/my.vue'
import Search from '@/components/HOME/search.vue'
import Loading from '@/components/loading/loading.vue'
import List from '@/components/List.vue'
// import Address from '@/components/HOME/Address.vue'
import Detail from '@/components/detail.vue'
const Address = () => import('@/components/HOME/Address.vue')
const EditAddress = () => import('@/components/HOME/editAddress.vue')
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    component: index,
    redirect: '/home',
    children: [
      {
        path: '/home',
        name: 'home',
        component: Home
      },
      {
        path: '/vip',
        name: 'vip',
        component: VIP
      },
      {
        path: '/car',
        name: 'car',
        component: Car
      },
      {
        path: '/my',
        name: 'my',
        component: My
      }
    ]
  },
  {
    path: '/search',
    name: 'search',
    component: Search
  },
  {
    path: '/loading',
    name: 'loading',
    component: Loading
  },
  {
    path: '/list',
    name: 'List',
    component: List
  },
  {
    path: '/detail',
    name: 'detail',
    component: Detail
  },
  {
    path: '/address',
    name: 'Address',
    component: Address
  },
  {
    path: '/editAddress',
    name: 'editAddress',
    component: EditAddress
  }
]

const router = new VueRouter({
  routes
})

export default router
